#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>
#include <string.h>
char* my_strncat(char* dest, const char* sour, size_t num)
{
	assert(dest && sour);
	char* begin = dest;
	size_t len = strlen(sour);
	size_t n = num < len ? num : len;
	while (*dest != '\0')
	{
		dest++;
	}
	int i = 0;
	for (i = 0; i < n; i++)
	{
		*dest++ = *sour++;
	}
	*dest = '\0';
	return begin;
}
int main()
{
	char arr1[20] = "hello ";
	char arr2[] = "word!";
	//printf("%s\n", my_strncat(arr1, arr2, 3));
	//printf("%s\n", my_strncat(arr1, arr2, 5));
	printf("%s\n", my_strncat(arr1, arr2, 8));

	return 0;
}